<?php $array_interests = preg_split('/[*]/', $interests); ?>
<?php $array_favArticles = preg_split('/[*]/', $favArticles); ?>
<?php $suattr = $sf_user->getAttribute('suattr') ?>
<div style="float: right;padding: 10px;">
    <a href="<?php echo url_for('@homepage') ?>"><b>Volver a Opinics</b></a>
</div>
<div id="configuration_menu">
<ul>
    <li class="selected"><a href="<?php echo url_for('@dashboard') ?>">Configuraci&oacute;n</a></li>
    <?php if($sf_user->hasCredential('author')){ ?>
    <li><a href="<?php echo url_for('@articles_new') ?>">Escribir un artículo</a></li>
    <?php } ?>
    <li><a href="<?php echo url_for('@history') ?>">Historial</a></li>
</ul>
</div>
<div id="configuration_content">
  <div id="configuration_in">
    <table width="100%">
      <tr>
        <td width="250px" valign="top">
          <h1>CONFIGURACI&Oacute;N</h1>
            <div id="tipo_cuenta" style="width: 225px;height: 32px;border: 1px solid #cdd2d6;margin-top: 10px;">
                <div style="float: left;padding: 10px;background-color: #cdd2d6;">tipo</div>
                <div style="float: left;padding: 10px;font-weight: bold;width: 129px;">
                    <?php echo $suattr[8] ?>
                </div>
                <div style="float: left;padding: 7px;">
                    <?php if($suattr[1]=='1'){ ?>
                      <?php echo image_tag('escritor.png','size=16x16') ?>
                    <?php }elseif($suattr[1]=='2'){ ?>
                      <?php echo image_tag('lector.png','size=16x16') ?>
                    <?php } ?>
                </div>
            </div>
          <br /><br /><br /><br />
            <div style="padding: 10px;">
              <?php if($sf_user->hasCredential('author')){ ?>
              <div style="padding: 10px;">
                <a href="<?php echo url_for('@myArticles') ?>">Mis articulos</a>
              </div>
              <div style="width: 60%;height: 1px;background-color: #cdd2d6;"></div>
              <?php } ?>
              <div style="padding: 10px;padding-top: 0;">
                <div style="position: relative;left: -20px;top: 13px;"><?php echo image_tag('bullet1.png') ?></div>
                <a href="<?php echo url_for('@myFavorites') ?>" style="font-weight: normal;"><b>Mis favoritos</b></a>
              </div>
              <div style="width: 60%;height: 1px;background-color: #cdd2d6;"></div>
              <div style="padding: 10px;">
                <a href="<?php echo url_for('@myBalance') ?>" style="font-weight: normal;">Ingresos</a>
              </div>
            </div>
        </td>
        <td width="5px">
            <div style="width: 1px;height: 300px;background-color: #cdd2d6;"></div>
        </td>
        <td width="745px" valign="top">
          <div style="padding: 15px;">
            <div class="section">
              <div class="title">
                  <div>MIS FAVORITOS</div>
              </div>
              <div class="body">
                <table>
                  <?php if($favArticles!='' && count($array_favArticles)>0){ ?>
                  <?php foreach($array_favArticles as $fa){ ?>
                    <?php $article =  ArticlePeer::retrieveByPK($fa); ?>
                    <tr class="table">
                      <td style="width: 650px;">
                        <a href="<?php echo url_for('@article?id='.$article->getId().'&slug='.$article->getSlug()) ?>">
                          <?php echo $article->getTitle() ?></a>
                      </td>
                      <td>
                        <a href="<?php echo url_for('@article_delete_favorites?id='.$article->getId()) ?>" onclick="return delete_confirm()"><?php echo image_tag('eliminar.png','size=16x16') ?></a>
                      </td>
                    </tr>
                    <tr>
                        <td><div style="width: 650px;height: 1px;background-color: #cdd2d6;margin-left: 10px;"></div></td>
                    </tr>
                  <?php } ?>
                  <?php }else{ ?>
                    <tr class="table">
                      <td colspan="2">
                        Usted no tiene art&iacute;culos favoritos. <a href="<?php echo url_for('@homepage') ?>" style="font-weight: bold;">Leer art&iacute;culos</a>
                      </td>
                    </tr>
                  <?php } ?>
                </table>
              </div>
              <br /><br /><br />
              <div class="section">
                <div class="title2">
                  <div>INTERESES</div>
                </div>
                <div style="width: 650px;height: 1px;background-color: #cdd2d6;margin-left: 10px;"></div>
                <div class="body">
                  <div style="padding: 15px;">
                    <form id="frmFav1" action="<?php echo url_for('@changeInterests') ?>" method="post">
                      <div style="width: 100%;height: auto;float: left;">
                        <?php foreach($subcategories as $subcategory){ ?>
                          <div style="float: left;padding: 5px;">
                            <input type="checkbox" name="interests[]" <?php if(in_array($subcategory->getId(), $array_interests)){echo 'checked';} ?>
                                   value="<?php echo $subcategory->getId() ?>" onclick="enable('#frmFav1 input[type=button]');" />
                                <?php echo $subcategory->getDescription() ?></div>
                        <?php } ?>
                      </div>
                      <div style="float: right;">
                          <input type="button" value="Guardar cambios" disabled onclick="submit('frmFav1')" style="padding: 10px;" />
                      </div>
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </td>
      </tr>
    </table>
  </div>
</div>